/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "turno")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Turno.findAll", query = "SELECT t FROM Turno t"),
    @NamedQuery(name = "Turno.findByCodTurno", query = "SELECT t FROM Turno t WHERE t.codTurno = :codTurno"),
    @NamedQuery(name = "Turno.findByFecha", query = "SELECT t FROM Turno t WHERE t.fecha = :fecha"),
    @NamedQuery(name = "Turno.findByHora", query = "SELECT t FROM Turno t WHERE t.hora = :hora")})
public class Turno implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cod_turno")
    private String codTurno;
    @Basic(optional = false)
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Basic(optional = false)
    @Column(name = "hora")
    private String hora;
    @JoinColumn(name = "cod_conduc", referencedColumnName = "cod_user")
    @ManyToOne(optional = false)
    private Usuario codConduc;
    @JoinColumn(name = "codbus", referencedColumnName = "cod_bus")
    @ManyToOne(optional = false)
    private Bus codbus;
    @JoinColumn(name = "codruta", referencedColumnName = "cod_ruta")
    @ManyToOne(optional = false)
    private Ruta codruta;

    public Turno() {
    }

    public Turno(String codTurno) {
        this.codTurno = codTurno;
    }

    public Turno(String codTurno, Date fecha, String hora) {
        this.codTurno = codTurno;
        this.fecha = fecha;
        this.hora = hora;
    }

    public String getCodTurno() {
        return codTurno;
    }

    public void setCodTurno(String codTurno) {
        this.codTurno = codTurno;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getHora() {
        return hora;
    }

    public void setHora(String hora) {
        this.hora = hora;
    }

    public Usuario getCodConduc() {
        return codConduc;
    }

    public void setCodConduc(Usuario codConduc) {
        this.codConduc = codConduc;
    }

    public Bus getCodbus() {
        return codbus;
    }

    public void setCodbus(Bus codbus) {
        this.codbus = codbus;
    }

    public Ruta getCodruta() {
        return codruta;
    }

    public void setCodruta(Ruta codruta) {
        this.codruta = codruta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTurno != null ? codTurno.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Turno)) {
            return false;
        }
        Turno other = (Turno) object;
        if ((this.codTurno == null && other.codTurno != null) || (this.codTurno != null && !this.codTurno.equals(other.codTurno))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Clases.Turno[ codTurno=" + codTurno + " ]";
    }
    
}
